package implementation.client;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collection;

import implementation.client.IUserInput.EUserAction;
import implementation.shared.stubs.IForumStub;
import implementation.shared.stubs.IPostStub;
import implementation.shared.stubs.IThreadStub;
import implementation.shared.stubs.IUserStub;

/*
public class ConsoleUI implements IUI{
	
	private final BufferedReader _reader = new BufferedReader(new InputStreamReader(System.in));
	private EUserAction _defualt;
	
	public void translateUserOutputInputToScreen(IUserInput userInput){
		
		ArrayList<EUserAction> operations = userInput.getListOfOperations();
		
		System.out.println("the operations that you can do are :");
		for (int i=0, max=operations.size();i<max;i++){
			System.out.print(i + " :  ");
			System.out.print(operations.get(i) +"  ");
		}		
		System.out.println("");
		
		System.out.println("enter  an action number please :" ) ;
		String str="'";
		
		try {
			str = this._reader.readLine();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		
		int tmp=6;
	
		try {
			tmp=Integer.parseInt(str);
		} catch (NumberFormatException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	
		
		userInput.setSelectedAction(operations.get(tmp));
		
		
		if (_defualt==userInput.getSelectedAction())
		for  (int i=0, max=userInput.paramCount();i<max;i++){
			System.out.println("enter " + userInput.getUserParameterName(i) + " Please :" ) ;
			
				try {
					str = this._reader.readLine();
				} catch (IOException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
				userInput.setUserParameter(i, str);
				
		}
		
		System.out.println("*****************************************");
		

	}

	@Override
	public void showLogin(IUserInput userInput) throws IOException {
		_defualt=EUserAction.ELogin;
		translateUserOutputInputToScreen(userInput);
		
	}

	@Override
	public void showRegister(IUserInput userInput) throws IOException {
		_defualt=EUserAction.ERegister;
		translateUserOutputInputToScreen(userInput);
		
	}

	@Override
	public void showAddFriend(IUserInput userInput) throws IOException {
		_defualt=EUserAction.EAddFriend;
		translateUserOutputInputToScreen(userInput);
		
	}

	@Override
	public void showRemoveFriend(IUserInput userInput) throws IOException {
		_defualt=EUserAction.ERemoveFriend;
		translateUserOutputInputToScreen(userInput);
		
	}

	@Override
	public void showFriends(IUserInput userInput,
			Collection<IUserStub> userList) throws IOException {
		_defualt=EUserAction.EGetFriends;
		// TODO Auto-generated method stub
		
	}

	@Override
	public void showForumList(IUserInput userInput,
			Collection<IForumStub> _forums) {	
		
		_defualt=EUserAction.EGetForum;
		System.out.println(" 				Forums : ");
		//System.out.println(" name : " + _forums.get(0).getID()  + " " +  _forums.get(0).getName()) ;
		for (IForumStub iForumStub : _forums) {
			System.out.println("-------------------------------------------------\n"+
								"Forum ID : " + iForumStub.getID() +
								"\nFourm  name : " + iForumStub.getName( )+
								"\n-------------------------------------------------");
		}
		
	
		translateUserOutputInputToScreen(userInput);
		
		
	}

	@Override
	public void showForum(IUserInput userInput, Collection<IThreadStub>  forum) {
		_defualt=EUserAction.EGetThread;
		System.out.println(" 				Threads : ");
		for (IThreadStub iThreadStub : forum) {			
			
			System.out.println("-------------------------------------------------\n"+
								"Thread Id : " + iThreadStub.get_threadID() + 
								"\nTopic :" + iThreadStub.get_threadTopic() +
								"\n-------------------------------------------------");
		}

		translateUserOutputInputToScreen(userInput);
		
	}



	@Override
	public void showThread(IUserInput userInput, Collection<IPostStub> thread) {
		_defualt=EUserAction.EGetPost;
		
		System.out.println(" 				Posts : ");
		for (IPostStub iPostStub : thread) {
			
			
			System.out.println( "-------------------------------------------------\n"+
								"Post Id  : " + iPostStub.getPostId() + 
								"\nTopic   : " + iPostStub.getPostTopic() +
								"\nContent : " +iPostStub.getPostContent() +
								"\n-------------------------------------------------");
		}

		translateUserOutputInputToScreen(userInput);
		
		
	}
	

	
	@Override
	public void showPost(IUserInput userInput, IPostStub post) {
		_defualt=EUserAction.EGetPost;
		// TODO Auto-generated method stub
		
	}

	@Override
	public void showAddPost(IUserInput userInput) throws IOException {
		_defualt=EUserAction.EAddPost;
		translateUserOutputInputToScreen(userInput);
		
	}

	@Override
	public void showAddThread(IUserInput userInput) throws IOException {
		_defualt=EUserAction.EAddThread;
		translateUserOutputInputToScreen(userInput);
		
	}

	


	@Override
	public void showMainScreen(IUserInput userInput) {
		_defualt=EUserAction.EShowMainScreen;
		translateUserOutputInputToScreen(userInput);
		
	}

	@Override
	public void showClientSideError(String error) {
		
		System.out.println("Error: " + error);
		
	}

	@Override
	public void showClientSideMessage(String msg) {
		System.out.println("message: " +msg);
		
	}

	@Override
	public void showUserChoise() {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void showProfile(IUserInput userInput) {
		_defualt=EUserAction.EProfile;
		translateUserOutputInputToScreen(userInput);
		
	}
	
	
}
*/